<?php 
$cs=Yii::app()->clientScript;
$cs->registerScript('send_sms',<<<END
$(".lab").click(function(){\$(this).prev("input[type=checkbox]").click();return false;});
$("#sel_all").click(function(){\$("input[type=checkbox]").attr('checked',1);});
$("#sel_empty").click(function(){\$("input[type=checkbox]").attr('checked',0);});
function check_receiver(){
	if($("input[type=checkbox]:checked").length>0) return true;
	alert('最少选择一个收信人！'); return false;
}
$("form").submit(check_receiver);
END
);
?>
<h2>发送短信息</h2>
<div class="yiiForm">
<?php
	echo EHtml::form();	
	EHtml::setOptions(array('errorElement'=> 'span'));
?>
<div>注：<span class="required">*</span>为必填项</div>
<div class="simple4">

<?php echo CHtml::activeLabelEx($model,'msg'); ?>
<?php echo EHtml::activeTextArea($model,'msg',array('rows'=>6, 'cols'=>65)); ?>
</div>
<div style='margin-left:0px;padding-left:20px;border-left: 1px solid #90b3bc;border-right:1px solid #90b3bc;line-height:30px;background-color: #ffffff;'>
选择司机<input type='button' value='全选' id='sel_all'/><input type='button' value='全否' id='sel_empty'/></div>
<?php
foreach($driver_models as $n=>$driver){
	if($n%8==0&&$n>0) echo '</div>';
	if($n%8==0&&$n/8%2==0) echo '<div class="simple4">';
	if($n%8==0&&$n/8%2==1) echo '<div class="simple4" style="background-color: #ffffff;">';
	echo CHtml::checkBox('Sms_queue[driver_id][]',false,array('value'=>$driver->id));
	echo "<a href='#' class='lab' title='$driver->mobile_no'>".$driver->name.'</a>&nbsp;&nbsp;&nbsp;&nbsp;';
}
if(count($driver_models)%8!=0) echo '</div>';
?>

<div class="action">
<?php echo EHtml::submitButton('发送短信'); ?>
</div>

<?php echo EHtml::endForm(); ?>

</div><!-- yiiForm -->
<?php 
if(isset($_GET['ok'])) {if($_GET['ok']==0) $mess='发送成功！';unset($_GET['ok']);}//判断添加/更新信息
if(isset($mess)) echo "<script>alert('$mess');</script>";
?>